home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / dirsize.zip / DIRSIZE.DOC < prev    next >
Text File  |  1994-01-30  |  6KB  |  145 lines

  1.  
  2.    NAME
  3.     DirSize -- Report size informations on a directory tree (V37)
  4.  
  5.    SYNOPSIS
  6.     DirSize DIR,P=PATTERN,BS=BLOCKSIZE/N,EXT=EXTENSION/N,ALL/S,LINKS/S
  7.  
  8.    FUNCTION
  9.     Report the number of files and directories, along with the total
  10.     amount of bytes and blocks used, contained in a specified directory
  11.     (including, at your option, its subdirectories).
  12.  
  13.     DirSize will not rely on DOS to calculate the block usage of a file:
  14.     instead, it will make it's own calculations based on the block size
  15.     and on the number of blocks which an extension block can keep track
  16.     of (refer to the AmigaDOS Manual for more informations on this);
  17.     these parameters can be entered on the command line (but have
  18.     reasonable defaults). In this way you can calculate what would be
  19.     the space required for a bunch of files in your RAM disk or FFS hard
  20.     disk once copied to floppy disk(s) (or vice-versa).
  21.  
  22.    INPUTS
  23.     DIR - Name of the directory to read.
  24.         If omitted, DirSize will read the current directory.
  25.  
  26.     P=PATTERN - File pattern to look for.
  27.         With this option you can specify which files you want to consider
  28.         (or to exclude).
  29.  
  30.         This option does not affect directories; directories are always
  31.         included in the count.
  32.  
  33.     BLOCKSIZE/N - Number of bytes contained in a data block.
  34.         Defaults to 512, the size of FFS data blocks.
  35.  
  36.         This value is 512 for FFS volumes, 488 for OFS volumes, and 1024
  37.         for the 2.04 RAM disk. Other values are possible, but unlikely.
  38.         DirSize will not accept block sizes less than 8 (no upper limit).
  39.  
  40.     EXTENSION/N - Number of block pointers in an extension block.
  41.         Defaults to 72, the correct value for both FFS and OFS.
  42.  
  43.         This value is 72 for all known Amiga filesystems except the RAM
  44.         disk, which uses a different (and to me unknown) method to keep
  45.         track of the blocks belonging to a file. Set it to zero if you
  46.         want to calculate the number of blocks used in a RAM disk (pretty
  47.         useless operation, but if you want, you can).
  48.  
  49.     ALL/S - Enter subdirectories recursively.
  50.  
  51.     LINKS/S - Count hard links as if they were real directories (by
  52.         entering them recursively) or files (by adding their byte and
  53.         block size to the total).
  54.  
  55.         By default a hard link, either to directory or file, will only
  56.         increment the block count (it does use space, so it's included in
  57.         the count; please tell me if you think it should be ignored),
  58.         without being entered if it is a directory, or being added to the
  59.         byte count if it is a file.
  60.  
  61.         Soft links are not handled, mainly because nobody uses them (as
  62.         above, please tell me if you think they should be).
  63.  
  64.    RESULT
  65.     '%ld files - %ld dirs - %ld bytes - %ld blocks'
  66.  
  67.     I think the output is clear enough. Just for completeness, I'll say
  68.     that the byte count is simply a sum of the sizes of all files, and
  69.     doesn't take into account the extension blocks and the bytes which
  70.     could be left unused at the end of the last data block of a file.
  71.  
  72.     The possible return codes are:
  73.      - RETURN_OK    ( 0): all ok;
  74.      - RETURN_WARN  ( 5): generic error reading directory;
  75.      - RETURN_ERROR (10): wrong arguments;
  76.      - RETURN_FAIL  (20): no libraries or memory.
  77.  
  78.    NOTES
  79.     A directory will always count as one block used. If you want to know
  80.     how many blocks your files are taking, just do (blocks - dirs).
  81.  
  82.     DirSize is not pure, because it uses only one instance of DOSBase to
  83.     avoid strange tricks; but it's very unlikely that dos.library fails
  84.     to open, and it does always return the same address (no task-specific
  85.     data). So it is safe to make DirSize resident.
  86.  
  87.     Don't worry about DirSize or other programs reporting one more block
  88.     used than Info reports: in certain conditions, which I wasn't able
  89.     to determine for sure (seems when the disk is more than 50% full),
  90.     Info (in fact, the omonymous DOS call it uses) reports that there is
  91.     one more block free than there really is, even when the disk is full.
  92.     I think this is a bug, or undocumented feature, of dos.library 37.44
  93.     (Kickstart 37.175).
  94.  
  95.    EXAMPLES
  96.     DirSize Devel: *.c all
  97.         would count all my C source files, producing:
  98.         '266 files - 179 dirs - 1400769 bytes - 3318 blocks'
  99.  
  100.     DirSize Work: ~(*.info)
  101.         would count the files and directories in the root of my hard
  102.         disk, excluding icons.
  103.  
  104.    BUGS
  105.     I hope and think none serious enough to damage your computer, or even
  106.     to show up that blinking alert called guru.
  107.  
  108.     Of course, I wish to hear about the bugs you might find.
  109.  
  110.    FUTURE
  111.     Support patterns on protection bits, dates, etc. Ever needed to know
  112.     how many megabytes you had to backup, i.e. no 'a' bit set?
  113.  
  114.     Use utility.library for 32-bit multiplies and divides (thus avoiding
  115.     the linking with sc.lib).
  116.  
  117.     Ability to read the block size from the device (via Info()).
  118.  
  119.     Multiple source directories.
  120.  
  121.    DISTRIBUTION
  122.     This program is freeware. You may redistribute it as long as:
  123.      - this text and the source code are included;
  124.      - you don't charge more than a nominal copying fee for distribution.
  125.  
  126.     Please state your modifications to the code with a clear comment, and
  127.     send me your modified version. It would be a good idea to include
  128.     the original code, anyway.
  129.  
  130.     Any contribution will be greatly appreciated (I'm a poor engineering
  131.     student, you know).
  132.  
  133.    DISCLAIMER
  134.     The author does not assume any responsibility for damages which could
  135.     result by the use of this program. The entire risk for the use of
  136.     this program is assumed by the user.
  137.  
  138.    AUTHOR
  139.     Flavio Stanchina
  140.     Loc. Montevaccino, 39
  141.     38040 Trento (Italia)
  142.  
  143.     email: 2:333/408.9@fidonet.org
  144.  
  145.